package com.xp.gather2.controller;

import com.xp.gather2.entity.Lampstate;
import com.xp.gather2.service.LampstateService;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 灯状态信息(Lampstate)表控制层
 *
 * @author 张川
 * @since 2019-05-17 16:14:51
 */
@RestController
@Api(description = "灯状态信息接口")
@RequestMapping("/lampState")
public class LampstateController {
    /**
     * 服务对象
     */
    @Resource
    private LampstateService lampstateService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
         @ApiOperation(value = "单个查询",notes = "根据id查询")
    @ApiImplicitParams({
    /**
      *参数描述
      */
      @ApiImplicitParam(paramType = "query",name = "id",dataType = "String",required = true,value = "唯一标识")
    })
    @ApiResponses({
            @ApiResponse(code = 200,message = "成功"),
            @ApiResponse(code=400,message = "请求参数没填好"),
            @ApiResponse(code = 404,message = "请求路径没对")
    })
    @GetMapping("selectOne")
     @RequiresRoles("admin")
    public Lampstate selectOne(Integer id) {
        return this.lampstateService.queryById(id);
    }

}
